﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Content.Master" Inherits="System.Web.Mvc.ViewPage<MethodWorx.CMS.UI.Models.PreviewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    
    <script language="javascript">

        $(document).ready(function () {
            var buttons = new Array();
            buttons.push({ text: "Refresh", hasText: false, id: "refresh", icon: "<%=Url.Content("~/images/icons/arrow_refresh.png")%>" });
            buttons.push({ text: "Publish", hasText: false, id: "publish", icon: "<%=Url.Content("~/images/icons/asterisk_orange.png")%>" });

            MethodWorx.CMS.Toolbar.setButtons(buttons, "#toolbar");

            resize();
            $(window).resize(resize);

            $("div.content").css("margin-left", "0");
            $("div.content").css("margin-right", "0");
            $("div.content").css("margin-bottom", "0");
            $("div.content").css("padding-bottom", "0");
            $(document.body).css("overflow", "hidden");

            $("#refresh").click(function () {
                //$("#previewFrameContainer").html("");
                $("#previewFrameContainer").html('<iframe src="<%=Url.Content(this.ViewData.Model.Url) %>" id="previewFrame" name="previewFrame" frameborder="0" style="width:100%;height:100%"></iframe>');
            });

            $("#publish").click(function () {
                if (confirm("Are you sure you want to publish this page?")) {
                    $.getJSON("<%=Url.Content("~/Page")%>/Publish/<%=this.ViewData.Model.Page.Id %>", function (data) {
                        alert("Page was successfully published");
                    });
                }
            });
        });

        function resize() {
            $("#previewFrameContainer").width($(window).width());
            $("#previewFrameContainer").height($(window).height() - 19);
        }



    </script>

    <div id="previewFrameContainer">
    <iframe src="<%=Url.Content(this.ViewData.Model.Url) %>" id="previewFrame" name="previewFrame" frameborder="0" style="width:100%;height:100%">
    </iframe>
    </div>


</asp:Content>
